<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>KOREAN管理系统-请登录</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" />
        <meta content="Coderthemes" name="author" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <!-- App favicon -->
        <link rel="shortcut icon" href="__STATIC__/assets/images/favicon.ico">
        <!-- App css -->
        <link href="__STATIC__/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <link href="__STATIC__/css/icons.min.css" rel="stylesheet" type="text/css" />
        <link href="__STATIC__/css/app.min.css" rel="stylesheet" type="text/css" />

    </head>

    <body class="authentication-bg">

        <div class="account-pages mt-5 mb-5">
            <div class="container">
                <div class="row justify-content-center">
                    <div class="col-lg-5">
                        <div class="card">

                            <div class="card-body p-4">
                                
                                <div class="text-center w-75 m-auto">
                                    <a href="../_index/index.html">
                                        KOREAN管理系统-登录
                                    </a>
                                </div>

                                <form id="logform" action="/admin" method="post">

                                    <div class="form-group mb-3">
                                        <label for="username">用户名</label>
                                        <input class="form-control" type="user" id="username" name="username" required="" placeholder="请输入您的用户名">
                                    </div>

                                    <div class="form-group mb-3">
                                        <a href="pages-recoverpw.html" class="text-muted float-right"><small></small></a>
                                        <label for="password">密码</label>
                                        <input class="form-control" type="password" name="password" required="" id="password" placeholder="请输入您的密码">
                                    </div>

                                    <div class="form-group mb-0 text-center">
                                        <button class="btn btn-primary btn-block" type="submit">登录</button>
                                    </div>

                                </form>
                            </div> <!-- end card-body -->
                        </div>
                        <!-- end card -->
                        <!-- end row -->

                    </div> <!-- end col -->
                </div>
                <!-- end row -->
            </div>
            <!-- end container -->
        </div>
        <!-- end page -->


        <!-- App js -->
        <script src="__STATIC__/js/vendor.min.js"></script>
        <script src="__STATIC__/js/app.min.js"></script>
        <script>
            $(document).ready(function (e) {
                $("#logform").submit(function (e) {
                    $istrue=false;
                    $.ajax({
                        url:'/admin/chklogin',
                        async:false,
                        type:'POST',
                        data:{
                            "username":$("input[name='username']").val(),
                            "password":$("input[name='password']").val(),
                        },
                        success:function (res) {
                            console.log(res);
                            if(res=="success"){
                                alert("登录成功");
                                $istrue=true;
                            }else{
                                alert("登录失败,请重试!");
                                $istrue=false;
                            }
                        },error:function (e) {
                            alert("网络连接错误,请重试!");
                            $istrue=false;
                        }
                    });
                    return $istrue;
                })
            })
        </script>
    </body>
</html>